LUNAR LANDER

This is the skeleton of a Lunar Lander game showing how to get sprite animation working.

It takes some ideas from the Lunar Lander as built using the Android SDK version.
The scripting though uses a HyperNext approach and not the Java Android SDK approach.


__________
GAME PLAY

The aim is to land the ship safely on the landing pad
For a safe landing the ship's sidways speed must be zero and its vertical speed less than 2 units per sec.
If the ship leaves the screen then its Game-Over.

Control using either the on screen buttons or tracker ball.
The engine is fired using the fire button which gives a vertical boost.
The left and right buttons give a sideways boost.
Every frame gravity affects the ship.
There is only enough fuel for 10 bursts.

The instrument panel is very basic and has the following bars:
- fuel is light blue when available
- sideways speed is green when safe, red when unsafe
- vertical speed is green when safe, red when unsafe

Difficulty levels can be chosen via the menu - Easy Normal and Hard.



_____________
PROGRAMMING

The speed of the game and physics calculations is controlled by the animation refesh speed of 25 frames/second.
In a real game that was independent of screen refresh rate the physics could be placed in a timer on the card.

There are scripts in the card, buttons, MainCode and Special-Animation sections.
 
The variables for acceleration, fuel amount, crash speed etc are in the MainCode section - variables

There are several procedures for setting up the game in the MainCode section.

Difficulty levels can be chosen via the menu - Easy Normal and Hard:-
these just set the safespeed.

NOTE
The speed of ship movement is relative to the animation framerate but in a real game
the movement would be independent of frame rate and relative to a clock.

 
______
IMAGES

All images are in the project's "Local" folder

The ship images aere all 75x90 pixels with the bottom 13 pixels being blank except when the engine firing is showing.
These 13 pixels are taken into account when calcualting whether the ship has landed or not.